package com.rolfhoward.video.record.widget

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.RelativeLayout
import com.rolfhoward.video.R
import kotlinx.android.synthetic.main.view_video_preview_header.view.*

/**
 *@author wuqiubin
 *@date 2023/1/16
 *@Describe
 */
class PreviewTopView :RelativeLayout{

    private var mRatioPop:RatioPopupWindow?=null
    private var mMorePop = null
    constructor(context: Context?) : super(context)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs){
        initView(context)
    }

    private fun initView(context: Context?) {
        val view = LayoutInflater.from(context).inflate(R.layout.view_video_preview_header, this,true)
        //退出
        view.video_pre_header_close.setOnClickListener {  }
        //切换预览尺寸
        view.video_pre_header_ratio.setOnClickListener {
            if (null == mRatioPop){
                mRatioPop = RatioPopupWindow(context)
            }
            mRatioPop?.hindPop()
            mRatioPop?.showPop(view.video_pre_header_ratio)
        }
        //切换前后摄像头
        view.video_pre_header_switch.setOnClickListener {  }
        //更多
        view.video_pre_header_more.setOnClickListener {  }
    }

    /**隐藏预览尺寸弹窗*/
    fun hideRatioPop(){
        mRatioPop?.hindPop()
    }

    /**隐藏设置弹窗*/
    fun hideSettingPop(){
//        mMorePop?.
    }
}